package iblink.adapter;

import iblink.adapter.request.RequestFactory;
import packutil.idgen.IIdGenerator;
import packutil.idgen.IIdGeneratorFactory;

public class IBFacadeFactory implements IIBFacadeFactory {

	private IIBClientFactory ibClientFactory;
	private IIdGenerator commonRequestIdGenerator;

	public IBFacadeFactory(IIBClientFactory ibClientFactory,
			IIdGeneratorFactory idGenFactory) {
		this.commonRequestIdGenerator = idGenFactory.createIdGenerator();
		this.ibClientFactory = ibClientFactory;
	}

	public IBFacade createIBFacade() {
		IBClient client = ibClientFactory.createIBClient();
		return new IBFacade(client, new RequestFactory(client,
				commonRequestIdGenerator));
	}
}